package main

import "fmt"

type person struct {
	name string
	city string
	age  int
}

func (p *person) Dream() {
	fmt.Println(p.name, "的梦想是学好golang！!")
}

// Person的构造函数
func newPerson(name, city string, age int) *person {
	return &person{
		name: name,
		city: city,
		age:  age,
	}
}

func main() {
	/*	var p1 person
		p1.name = "张三"
		p1.city = "武汉"
		p1.age = 18*/
	var p1 *person
	p1 = newPerson("张三", "武汉", 19)
	fmt.Printf("p1=%v\n", p1)
	fmt.Printf("p1=%#v\n", p1)
	p1.Dream()

	var user struct {
		Name string
		Age  int
	}
	user.Name = "用户"
	user.Age = 20
	fmt.Printf("user=%v\n", user)
	fmt.Printf("user=%#v\n", user)
}
